import request from '@/utils/request'

// 查询学生贷款列表
export function listData(query) {
  return request({
    url: '/student/credit/data/list',
    method: 'get',
    params: query
  })
}

// 查询学生贷款详细
export function getData(creditId) {
  return request({
    url: '/student/credit/data/' + creditId,
    method: 'get'
  })
}

export function getCredits(userName) {
  return request({
    url: '/student/credit/data/name/' + userName,
    method: 'get'
  })
}

// 根据贷款年度查询学生贷款信息
export function selectCreditByDuringYearAndUserName(duringYear, userName) {
  return request({
    url: '/student/credit/data/year/' + duringYear + '/' + userName,
    method: 'get'
  })
}

// 查询最新添加的一条记录
export function selectNewCreateByUserName(userName) {
  return request({
    url: '/student/credit/data/new/selectNewOne/' + userName,
    method: 'get'
  })
}

// 新增学生贷款
export function addData(data) {
  return request({
    url: '/student/credit/data',
    method: 'post',
    data: data
  })
}

// 修改学生贷款
export function updateData(data) {
  return request({
    url: '/student/credit/data',
    method: 'put',
    data: data
  })
}

// 删除学生贷款
export function delData(creditId) {
  return request({
    url: '/student/credit/data/' + creditId,
    method: 'delete'
  })
}

// 导出学生贷款
export function exportData(query) {
  return request({
    url: '/student/credit/data/export',
    method: 'get',
    params: query
  })
}


// 在pdf上添加签章
export function signatureToPdf(data) {
  return request({
    url: '/student/credit/data/signatureToPdf',
    method: 'put',
    data: data
  })
}

// 借款人上传电子签名
export function updateFirstSignature(data) {
  return request({
    url: '/student/credit/data/updateFirstSignature',
    method: 'put',
    data: data
  })
}

// 县资助中心上传电子签名
export function updateSecondSignature(data) {
  return request({
    url: '/student/credit/data/updateSecondSignature',
    method: 'put',
    data: data
  })
}
